//
//  SLDeployRecomendCell.m
//  StarLight
//
//  Created by 吴涛 on 16/6/5.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

#import "SLDeployRecomendCell.h"

@implementation SLDeployRecomendCell



- (instancetype)initWithFrame:(CGRect)frame{
  if (self = [super initWithFrame:frame]) {
    [self.rightBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
    [self.rightBtn addTarget:self action:@selector(delectAction) forControlEvents:UIControlEventTouchUpInside];
    [self.currentLocBtn removeTarget:self action:NULL forControlEvents:UIControlEventTouchUpInside];
    [self.currentLocBtn addTarget:self action:@selector(locationAction) forControlEvents:UIControlEventTouchUpInside];
  }
  return self;
}

- (void)configNearlyCellWithShipModel:(SLNearLyShip *)shipModel{
  [super configNearlyCellWithShipModel:shipModel];
  self.shipModel = shipModel;
}

- (void)configNearlyCellWithProductModel:(SLNearLyProduct *)productModel{
  [super configNearlyCellWithProductModel:productModel];
  self.goodsModel = productModel;
}

- (void)delectAction{
  
  if (self.cellType == NearlyCellTypeShip) {
    if (_recDelegate && [_recDelegate respondsToSelector:@selector(cellDelectBtnWasTapedWithGoodsModel:)]) {
      [_recDelegate cellDelectBtnWasTapedWithGoodsModel:self.goodsModel];
    }
  }else {
    if (_recDelegate && [_recDelegate respondsToSelector:@selector(cellDelectBtnWasTapedWithShipModel:)]) {
      [_recDelegate cellDelectBtnWasTapedWithShipModel:self.shipModel];
    }
  }
  
  
}

- (void)locationAction{
  if (_recDelegate && [_recDelegate respondsToSelector:@selector(cellLocationBtnWasTapedWithShipModel:)]) {
    [_recDelegate cellLocationBtnWasTapedWithShipModel:self.shipModel];
  }
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
